<?php

namespace common\entities\outstock;

use Yii;

/**
 * This is the model class for table "myscrm_delivery_order".
 *
 * @property string $delivery_guid
 * @property string $order_code
 * @property string $created_on
 * @property string $customer_full_name
 * @property string $customer_id
 * @property string $top_customer_guid
 * @property string $top_customer_name
 * @property integer $delivery_scene
 * @property string $deliver_name
 * @property string $deliver_guid
 * @property string $org_code
 * @property string $top_customer_fullname
 * @property string $customer_name
 * @property integer $business_pattern
 * @property string $deliver_buguid
 * @property integer $special_type
 * @property string $promise_fulfil_time
 * @property string $promise_fulfil_principle
 * @property string $promise_fulfil_name
 * @property integer $is_new_org
 * @property string $sign_people_id
 * @property string $sign_people_name
 * @property string $sign_people_tel
 * @property string $sign_people_mail
 * @property string $adviser_guid
 * @property string $adviser_name
 * @property string $adviser_tel
 * @property string $adviser_mail
 * @property string $remark
 * @property string $modified_on
 * @property string $org_name
 * @property string $deliver_buname
 * @property string $org_id
 */
class MyscrmDeliveryOrderEntity extends \common\entities\ContractEntity
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'myscrm_delivery_order';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('contractDB');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['delivery_guid'], 'required'],
            [['created_on', 'promise_fulfil_time', 'modified_on'], 'safe'],
            [['delivery_scene', 'business_pattern', 'special_type', 'is_new_org'], 'integer'],
            [['remark'], 'string'],
            [['delivery_guid', 'order_code', 'customer_id', 'top_customer_guid', 'deliver_guid', 'deliver_buguid', 'promise_fulfil_principle', 'sign_people_id', 'adviser_guid', 'org_id'], 'string', 'max' => 36],
            [['customer_full_name', 'top_customer_name', 'top_customer_fullname', 'customer_name', 'org_name', 'deliver_buname'], 'string', 'max' => 100],
            [['deliver_name', 'org_code', 'promise_fulfil_name', 'sign_people_name', 'sign_people_mail', 'adviser_mail'], 'string', 'max' => 50],
            [['sign_people_tel', 'adviser_name', 'adviser_tel'], 'string', 'max' => 30]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'delivery_guid' => '出库GUID',
            'order_code' => '出库单号',
            'created_on' => '申请时间',
            'customer_full_name' => '签约客户全称',
            'customer_id' => '签约客户GUID',
            'top_customer_guid' => '顶级客户GUID',
            'top_customer_name' => '顶级客户简称',
            'delivery_scene' => '出库场景,1=正式产品,4=特批',
            'deliver_name' => '申请人名称',
            'deliver_guid' => '申请人GUID',
            'org_code' => 'Org Code',
            'top_customer_fullname' => '顶级客户全称',
            'customer_name' => '签约客户简称',
            'business_pattern' => '1-直属出库,2-联营出库',
            'deliver_buguid' => '申请人所属区域',
            'special_type' => '10=合同未归档款项未回,20=合同已归档款项未回,30=合同未归档款项已回',
            'promise_fulfil_time' => '兑现时间',
            'promise_fulfil_principle' => '兑现承诺人guid',
            'promise_fulfil_name' => '兑现承诺人',
            'is_new_org' => '是否开通过账号',
            'sign_people_id' => '签约人GUID',
            'sign_people_name' => '签约人名称',
            'sign_people_tel' => '签约人电话',
            'sign_people_mail' => '签约人邮箱',
            'adviser_guid' => '实施顾问GUID',
            'adviser_name' => '实施顾问名称',
            'adviser_tel' => '实施顾问电话',
            'adviser_mail' => '实施顾问 邮箱',
            'remark' => '出库备注',
            'modified_on' => '修改时间',
            'org_name' => '租户名称',
            'deliver_buname' => '申请人所在区域',
            'org_id' => '租户guid',
        ];
    }
}
